/*
 * GerenciadorFinanceiroView.java
 */

package gerenciadorfinanceiro;

import gerenciadorfinanceiro.database.resources.Outcome;
import gerenciadorfinanceiro.database.resources.User;
import gerenciadorfinanceiro.view.resources.BalanceteAnual;
import gerenciadorfinanceiro.view.resources.BalanceteMensal;
import gerenciadorfinanceiro.view.resources.CadastrarDespesa;
import gerenciadorfinanceiro.view.resources.CadastrarReceita;
import gerenciadorfinanceiro.view.resources.ConsultarDespesas;
import gerenciadorfinanceiro.view.resources.ConsultarReceitas;
import gerenciadorfinanceiro.view.resources.ImportarDados;
import java.text.DecimalFormat;
import java.util.Calendar;
import org.jdesktop.application.Action;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import java.util.GregorianCalendar;
import java.util.List;
import javax.swing.JDialog;
import javax.swing.JFrame;

/**
 * The application's main frame.
 */
public class GerenciadorFinanceiroView extends FrameView {

    public GerenciadorFinanceiroView(SingleFrameApplication app) {
        super(app);

        initComponents();
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
            aboutBox = new GerenciadorFinanceiroAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        GerenciadorFinanceiroApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        btnCadastrarDespesa = new javax.swing.JButton();
        btnConsultarDespesas = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        btnCadastrarReceita = new javax.swing.JButton();
        btnConsultarReceita = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        btnBalanceMensal = new javax.swing.JButton();
        btnBalanceAnual = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        btnImportarDados = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        lblDespesaMensal = new javax.swing.JLabel();
        txtDespesaMensal = new javax.swing.JTextField();
        lblDespesaTotalPermitida = new javax.swing.JLabel();
        txtDespesaTotalPermitida = new javax.swing.JTextField();
        txtDiasRestantes = new javax.swing.JTextField();
        txtDespesaDiaAtual = new javax.swing.JTextField();
        txtDespesaDiaPermitido = new javax.swing.JTextField();
        lblDiasRestantes = new javax.swing.JLabel();
        lblDespesaDiaAtual = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();

        mainPanel.setBorder(null);
        mainPanel.setName("mainPanel"); // NOI18N

        jTabbedPane1.setBorder(null);
        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jPanel2.setName("jPanel2"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(gerenciadorfinanceiro.GerenciadorFinanceiroApp.class).getContext().getActionMap(GerenciadorFinanceiroView.class, this);
        btnCadastrarDespesa.setAction(actionMap.get("CadastrarDespesa")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(gerenciadorfinanceiro.GerenciadorFinanceiroApp.class).getContext().getResourceMap(GerenciadorFinanceiroView.class);
        btnCadastrarDespesa.setText(resourceMap.getString("btnCadastrarDespesa.text")); // NOI18N
        btnCadastrarDespesa.setName("btnCadastrarDespesa"); // NOI18N

        btnConsultarDespesas.setAction(actionMap.get("ConsultarDespesa")); // NOI18N
        btnConsultarDespesas.setText(resourceMap.getString("btnConsultarDespesas.text")); // NOI18N
        btnConsultarDespesas.setName("btnConsultarDespesas"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnCadastrarDespesa, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnConsultarDespesas, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(376, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnCadastrarDespesa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnConsultarDespesas)
                .addContainerGap(17, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        btnCadastrarReceita.setAction(actionMap.get("CadastrarReceita")); // NOI18N
        btnCadastrarReceita.setText(resourceMap.getString("btnCadastrarReceita.text")); // NOI18N
        btnCadastrarReceita.setName("btnCadastrarReceita"); // NOI18N

        btnConsultarReceita.setAction(actionMap.get("consultarReceita")); // NOI18N
        btnConsultarReceita.setText(resourceMap.getString("btnConsultarReceita.text")); // NOI18N
        btnConsultarReceita.setName("btnConsultarReceita"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnCadastrarReceita, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnConsultarReceita, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE))
                .addContainerGap(384, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnCadastrarReceita)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnConsultarReceita)
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N

        jPanel4.setName("jPanel4"); // NOI18N

        btnBalanceMensal.setAction(actionMap.get("ExibirBalanceteMensal")); // NOI18N
        btnBalanceMensal.setText(resourceMap.getString("btnBalanceMensal.text")); // NOI18N
        btnBalanceMensal.setName("btnBalanceMensal"); // NOI18N

        btnBalanceAnual.setAction(actionMap.get("ExibirBalanceAnual")); // NOI18N
        btnBalanceAnual.setText(resourceMap.getString("btnBalanceAnual.text")); // NOI18N
        btnBalanceAnual.setName("btnBalanceAnual"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnBalanceAnual, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnBalanceMensal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(355, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnBalanceMensal)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBalanceAnual)
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N

        btnImportarDados.setAction(actionMap.get("ExibirImportarDados")); // NOI18N
        btnImportarDados.setText(resourceMap.getString("btnImportarDados.text")); // NOI18N
        btnImportarDados.setName("btnImportarDados"); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnImportarDados, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(552, 552, 552))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btnImportarDados)
                .addContainerGap(52, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        lblDespesaMensal.setText(resourceMap.getString("lblDespesaMensal.text")); // NOI18N
        lblDespesaMensal.setName("lblDespesaMensal"); // NOI18N

        txtDespesaMensal.setEditable(false);
        txtDespesaMensal.setText(resourceMap.getString("txtDespesaMensal.text")); // NOI18N
        txtDespesaMensal.setName("txtDespesaMensal"); // NOI18N

        lblDespesaTotalPermitida.setText(resourceMap.getString("lblDespesaTotalPermitida.text")); // NOI18N
        lblDespesaTotalPermitida.setName("lblDespesaTotalPermitida"); // NOI18N

        txtDespesaTotalPermitida.setEditable(false);
        txtDespesaTotalPermitida.setText(resourceMap.getString("txtDespesaTotalPermitida.text")); // NOI18N
        txtDespesaTotalPermitida.setName("txtDespesaTotalPermitida"); // NOI18N

        txtDiasRestantes.setEditable(false);
        txtDiasRestantes.setText(resourceMap.getString("txtDiasRestantes.text")); // NOI18N
        txtDiasRestantes.setName("txtDiasRestantes"); // NOI18N

        txtDespesaDiaAtual.setEditable(false);
        txtDespesaDiaAtual.setText(resourceMap.getString("txtDespesaDiaAtual.text")); // NOI18N
        txtDespesaDiaAtual.setName("txtDespesaDiaAtual"); // NOI18N

        txtDespesaDiaPermitido.setEditable(false);
        txtDespesaDiaPermitido.setText(resourceMap.getString("txtDespesaDiaPermitido.text")); // NOI18N
        txtDespesaDiaPermitido.setName("txtDespesaDiaPermitido"); // NOI18N

        lblDiasRestantes.setText(resourceMap.getString("lblDiasRestantes.text")); // NOI18N
        lblDiasRestantes.setName("lblDiasRestantes"); // NOI18N

        lblDespesaDiaAtual.setText(resourceMap.getString("lblDespesaDiaAtual.text")); // NOI18N
        lblDespesaDiaAtual.setName("lblDespesaDiaAtual"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDespesaMensal)
                    .addComponent(lblDespesaTotalPermitida)
                    .addComponent(lblDiasRestantes)
                    .addComponent(lblDespesaDiaAtual)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtDespesaTotalPermitida, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                    .addComponent(txtDespesaMensal, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                    .addComponent(txtDiasRestantes, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                    .addComponent(txtDespesaDiaAtual, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                    .addComponent(txtDespesaDiaPermitido, javax.swing.GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDespesaMensal)
                    .addComponent(txtDespesaMensal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDespesaTotalPermitida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDespesaTotalPermitida))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDiasRestantes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDiasRestantes))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDespesaDiaAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDespesaDiaAtual))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtDespesaDiaPermitido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        jMenuItem1.setAction(actionMap.get("AtualizarEstatisticas")); // NOI18N
        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        fileMenu.add(jMenuItem1);

        jSeparator1.setName("jSeparator1"); // NOI18N
        fileMenu.add(jSeparator1);

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents

    protected void carregarEstatisticas() {
        DecimalFormat df = new DecimalFormat("0");
        User u = util.getLoggedUser();

        Calendar c = new GregorianCalendar();
        List outcomes = util.getOutcomeDAO().getAllOucomes(u, c.get(Calendar.MONTH)+1, c.get(Calendar.YEAR));

        double totalDespesa = 0;

        for (Object o: outcomes) {
            totalDespesa += ((Outcome)o).getValue();
        }

        txtDespesaMensal.setText(df.format(Math.floor(totalDespesa))+"");

        double despesaPermitida = 1600;

        txtDespesaTotalPermitida.setText((int)despesaPermitida+"");

        long atual = c.getTimeInMillis();

        int dias = c.get(Calendar.DATE);
        int mes = c.get(Calendar.MONTH);
        int ano = c.get(Calendar.YEAR);

        if (mes == 11) {
            mes = 0;
            ano += 1;
        } else {
            mes++;
        }

        c.set(ano, mes, 01);
        long proximoMes = c.getTimeInMillis();

        int diferenca = Math.round((proximoMes - atual) / (24*60*60*1000));
        txtDiasRestantes.setText(""+(diferenca - 1));


        txtDespesaDiaAtual.setText(""+(int)(Math.ceil(totalDespesa / dias)));

        txtDespesaDiaPermitido.setText(""+(int)(Math.ceil((despesaPermitida - totalDespesa) / (diferenca - 1))));

    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBalanceAnual;
    private javax.swing.JButton btnBalanceMensal;
    private javax.swing.JButton btnCadastrarDespesa;
    private javax.swing.JButton btnCadastrarReceita;
    private javax.swing.JButton btnConsultarDespesas;
    private javax.swing.JButton btnConsultarReceita;
    private javax.swing.JButton btnImportarDados;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel lblDespesaDiaAtual;
    private javax.swing.JLabel lblDespesaMensal;
    private javax.swing.JLabel lblDespesaTotalPermitida;
    private javax.swing.JLabel lblDiasRestantes;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JTextField txtDespesaDiaAtual;
    private javax.swing.JTextField txtDespesaDiaPermitido;
    private javax.swing.JTextField txtDespesaMensal;
    private javax.swing.JTextField txtDespesaTotalPermitida;
    private javax.swing.JTextField txtDiasRestantes;
    // End of variables declaration//GEN-END:variables

    private JDialog aboutBox;

    private Utilitario util;
    private CadastrarDespesa formCadastrarDespesa;
    private CadastrarReceita formCadastrarReceita;
    private BalanceteMensal balanceteMensal;
    private BalanceteAnual balanceteAnual;
    private ConsultarDespesas consultarDespesas;
    private ConsultarReceitas consultarReceitas;
    private ImportarDados importarDados;

    public ImportarDados getImportarDados() {
        return importarDados;
    }

    public void setImportarDados(ImportarDados importarDados) {
        this.importarDados = importarDados;
    }

    /**
     * @return the util
     */
    public Utilitario getUtil() {
        return util;
    }

    /**
     * @param util the util to set
     */
    public void setUtil(Utilitario util) {
        this.util = util;
    }

    /**
     * @return the formCadastrarDespesa
     */
    public CadastrarDespesa getFormCadastrarDespesa() {
        return formCadastrarDespesa;
    }

    /**
     * @param formCadastrarDespesa the formCadastrarDespesa to set
     */
    public void setFormCadastrarDespesa(CadastrarDespesa formCadastrarDespesa) {
        this.formCadastrarDespesa = formCadastrarDespesa;
    }

    @Action
    public void CadastrarDespesa() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.formCadastrarDespesa.carregarForm();
        this.formCadastrarDespesa.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(formCadastrarDespesa);
    }

    @Action
    public void CadastrarReceita() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.formCadastrarReceita.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(this.formCadastrarReceita);
    }

    /**
     * @return the formCadastrarReceita
     */
    public CadastrarReceita getFormCadastrarReceita() {
        return formCadastrarReceita;
    }

    /**
     * @param formCadastrarReceita the formCadastrarReceita to set
     */
    public void setFormCadastrarReceita(CadastrarReceita formCadastrarReceita) {
        this.formCadastrarReceita = formCadastrarReceita;
    }

    @Action
    public void AtualizarEstatisticas() {
        this.carregarEstatisticas();
    }

    @Action
    public void ExibirBalanceteMensal() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.balanceteMensal.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(this.balanceteMensal);
    }

    /**
     * @return the balanceteMensal
     */
    public BalanceteMensal getBalanceteMensal() {
        return balanceteMensal;
    }

    /**
     * @param balanceteMensal the balanceteMensal to set
     */
    public void setBalanceteMensal(BalanceteMensal balanceteMensal) {
        this.balanceteMensal = balanceteMensal;
    }

    /**
     * @return the balanceteAnual
     */
    public BalanceteAnual getBalanceteAnual() {
        return balanceteAnual;
    }

    /**
     * @param balanceteAnual the balanceteAnual to set
     */
    public void setBalanceteAnual(BalanceteAnual balanceteAnual) {
        this.balanceteAnual = balanceteAnual;
    }

    @Action
    public void ExibirBalanceAnual() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.balanceteAnual.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(this.balanceteAnual);
    }

    @Action
    public void ConsultarDespesa() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.consultarDespesas.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(this.consultarDespesas);
    }

    /**
     * @return the consultarDespesas
     */
    public ConsultarDespesas getConsultarDespesas() {
        return consultarDespesas;
    }

    /**
     * @param consultarDespesas the consultarDespesas to set
     */
    public void setConsultarDespesas(ConsultarDespesas consultarDespesas) {
        this.consultarDespesas = consultarDespesas;
    }

    /**
     * @return the consultarReceitas
     */
    public ConsultarReceitas getConsultarReceitas() {
        return consultarReceitas;
    }

    /**
     * @param consultarReceitas the consultarReceitas to set
     */
    public void setConsultarReceitas(ConsultarReceitas consultarReceitas) {
        this.consultarReceitas = consultarReceitas;
    }

    @Action
    public void consultarReceita() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.consultarReceitas.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(this.consultarReceitas);
    }

    @Action
    public void ExibirImportarDados() {
        JFrame mainFrame = GerenciadorFinanceiroApp.getApplication().getMainFrame();
        this.importarDados.setLocationRelativeTo(mainFrame);
        GerenciadorFinanceiroApp.getApplication().show(this.importarDados);
    }
}
